using UnityEngine;

public class GetNameByRaycast : MonoBehaviour
{
    private Ray _ray;
    private RaycastHit _hit;
    private GameObject _obj;

    /*void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (Camera.main != null) _ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(_ray, out _hit))
            {
                _obj = _hit.collider.gameObject;
                Debug.Log($"点击物体 name = {_obj.name}, tag = {_obj.tag}");
            }
        }
    }*/
}
